﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace HaSdkWrapper
{

    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
    public struct ipscan_t
    {

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string mac;

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string ip;

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string netmask;

        /// char[16]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 16)]
        public string manufacturer;

        /// char[32]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
        public string platform;

        /// char[32]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
        public string system;

        /// char[64]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 64)]
        public string version;
    }

    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
    public struct ipset_t
    {

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string mac;

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string ip;

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string netmask;

        /// char[20]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 20)]
        public string gateway;
    }

    /// Return Type: void
    ///ipscan: ipscan_t*
    ///usr_param: int
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void discover_ipscan_cb_t(ref ipscan_t ipscan, int usr_param);


    public static class HaDiscover
    {
        const string DllName = "discover_client";
        /// Return Type: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "discover_client_init")]
        public static extern int discover_client_init();


        /// Return Type: void
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "discover_client_deinit")]
        public static extern void discover_client_deinit();



        /// Return Type: void
        ///cb: discover_ipscan_cb_t
        ///usr_param: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "discover_reg_ipscan_cb", CallingConvention = CallingConvention.Cdecl)]
        public static extern void discover_reg_ipscan_cb(discover_ipscan_cb_t cb, int usr_param);



        /// Return Type: void
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "discover_ipscan")]
        public static extern int discover_ipscan();


        /// Return Type: void
        ///mac: char*
        ///ip: char*
        ///netmask: char*
        ///gateway: char*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "discover_setip_bymac", CallingConvention = CallingConvention.Cdecl)]
        public static extern void discover_setip_bymac([System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string mac, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string ip, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string netmask, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string gateway);


    }
}
